package com.northpool.operator.serve;

public class ResponseEntity {
    // 状态码
    private Integer code;

    // 数据
    private Object data;

    // 信息
    private String message;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public static ResponseEntity ok(Object data) {
        ResponseEntity response = new ResponseEntity();
        response.setCode(200);
        response.setData(data);
        return response;
    }

    public static ResponseEntity error(Integer code, String message) {
        ResponseEntity response = new ResponseEntity();
        response.setCode(code);
        response.setMessage(message);
        return response;
    }

    public static ResponseEntity error(String message) {
        ResponseEntity response = new ResponseEntity();
        response.setCode(500);
        response.setMessage(message);
        return response;
    }
}
